home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
XCMD libraries 960603
/
Read.me
< prev
next >
Wrap
Text File
|
1996-06-04
|
5KB
|
102 lines
These are some additional notes for the xcmd Class presented here.
F 7386 7:03 PM 11/15/95 CWIE TEXT 0x0100 xcmdStrings.cp -- xcmdString class
F 4017 7:03 PM 11/15/95 CWIE TEXT 0x0100 xcmdStrings.h
F 6606 3:56 PM 11/15/95 CWIE TEXT 0x0100 xcmdBase.cp -- xcmdBase class
F 3002 10:21 PM 11/13/95 CWIE TEXT 0x0100 xcmdBase.h
F 10054 8:27 AM 11/16/95 CWIE TEXT 0x0100 xcmdWind.cp -- xcmdWind class
F 5185 8:27 AM 11/16/95 CWIE TEXT 0x0100 xcmdWind.h
o xcmdString
There are three base classes. The first is essential to both and provides
the glue for making the other two work smoothly: xcmdString. This class
handles all the troublesome conversions between pascal like and c like
strings. Strings passed in handles can be up to 32k in size. Standard
pascal strings can only accomodate 255. Many of the xcmd routines,
nevertheless, only take pascal string arguments. xcmdString provides a
seamless way to convert and use these containers without having to pay close
attention to the details. If you are familiar with the LString class in
power plant you will notice some superficial similarities. xcmdString was
devised many years before LString and is not as complete. It does, however,
take full advantage of the string conversion callbacks in order to a) save
code space and b) to remain consistant with the hc way of converting values.
It is designed and intended for use within the xcmd context and serves that
function well.
o xcmdBase
The next class is the xcmdBase class. If you are only seeking to create an
xcmd that does not need or use an xcmdWindow then you need only use this
class. There is only one instance of the xcmdBase class permitted per xcmd
call. Usually you set up an A4 frame, call the main cpp routine,
instantiate a member of the xcmdBase class with the paramPtr as a single
argument and go to it. The constructor copies the paramPtr to a common
global location so that all the call backs work without having to worry
about this detail. Parameters can be checked and states configured using
the xcmdString class.
A more likely scenario is to create a subclass of xcmdBase and include any
special methods and private storage for your methods.
o xcmdWind
The last class is a descendant of xcmdBase and handles xcmds with xwindows.
It takes care of most of the messy and mundane window handling routines
allowing you to deal with the important details. The best way to implement
your xWindow xcmd is to create a custom class and override only those
features you want to handle.
xcmdWind like xcmdBase, should probably be pure virtual. But I wanted to be
able to provide a simple default behavior without having to do a thing. In
other words, to create a simple, mindless, do nothing xcmd all you need do
is throw these classes into a project along with the example startup,
compile and go. Things will happen. Hopefully, not bad things. There are
some small caveats as with all stand alone code resources:
1) Include the New.cp provided with CW and be sure to set the
#define NEWMODE NEWMODE_SIMPLE switch. This will turn caching off
and allow the use of direct NewPtr and DisposPtr calls.
2) Be sure to set the preferences for an XCMD or XFCN code resource.
and DONT try to create a C++ entry point. Create a simple C main which
sets up the A4 environment and calls your C++ routine. If you fail to do
this when you destructor gets called after the A4 is restored, all hell
breaks loose. This is a good practice for any code resource.
See example provided.
To this project you need to add...
MacOS.lib, HyperXLib.o, CPlusPlusA4.lib, an ANSI A4 lib if needed., and your
modified New.cp with the appropriate declarations described above.
As always....
Please, please, please, in the unlikely event you should use this stuff
for some commercial application I would appreciate you contacting me. If
its for your own use, use away. Send email: knowsoft@ios.com
As always: this file is presented as is with no warrantees expressed or implied.
Swim at your own risk, etc. etc.
10/29/95 The library is posted to MW object code library. Originally
written for Symantec and ported to CW4.
11/11/95 After some months I tried using this with CW7. The
stricter type checking with the new compiler revealed some
minor potential bugs fixed here. I've made some simple
modifications to the xcmdBase file as well as xcmdString
object. While the interface is the same (don't you love
data hidding!) the structure of xcmdString is very
different. Instead of converting strings I simply pass
different offsets depending on whether a pascal or c string
is needed. My understanding of c++ has also matured so I
have made some minor modifications to xcmdBase in order to
take advantage of the better xcmdStrings implementation.
6/3/96 I just received CW9 and discovered some significant changes
in the E.T.O. version of the hypercard library. The XCMD libraries
here were modified to reflect those changes.
------------------------------------------------------------------------
Knowledge Software Consulting knowsoft@ios.com
1204 Hall Ave tel: (914) 428-6654
White Plains, NY 10604 fax: (914) 993-9210